package com.atguigu.day23.work;

import java.io.*;

public class Work4 {
    public static void main(String[] args) {

        try (
                FileInputStream fis = new FileInputStream("D:\\shanguigu\\share1\\day1123\\我想对你说.txt");
                BufferedInputStream bis = new BufferedInputStream(fis);
                InputStreamReader isr = new InputStreamReader(bis, "GBK");
                FileOutputStream fos = new FileOutputStream("testIO/你好.txt");
                BufferedOutputStream bos = new BufferedOutputStream(fos);
                OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8");
        ) {
            char[] date = new char[1024];
            int len;
            while ((len = isr.read(date)) != -1) {
                osw.write(date, 0, len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}